<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/11/9
 * Time: 14:15
 */
require_once "DbHelper.php";
class Basic{
    protected $dbHandle;
    public function __construct()
    {
        $this->dbHandle = new DbHelper();
    }

    protected function checkArguments($argu, $checkKeys){
        $insertData = [];
        foreach ($checkKeys as $key => $value){
            if (!isset($argu[$value])){
                throw new Error("参数{$value}不能为空");
            }else{
                $insertData[$value] = $argu[$value];
            }
        }
        return $insertData;
    }

    protected function encryptStr($toEnptyStr){
        $enptyedStr = base64_encode($toEnptyStr);
        $turnStr = trim($enptyedStr,"=");
        $turnStr = strrev($turnStr);
        return $turnStr;
    }

    protected function decryptStr($turnStr){
        $turnStr = strrev($turnStr);
        return base64_decode($turnStr);
    }
}